package com.yimi.yinhepda.adapter.RecycleAdapter;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;

import com.pda.ym.entity.bean.CarPlanTaskEntity;
import com.yimi.yinhepda.R;
import com.pda.ym.base.CommonRecycleAdapter;
import com.pda.ym.base.CommonViewHolder;
import com.yimi.yinhepda.entity.bean.SealOrUnsealTaskEntity;
import com.yimi.yinhepda.entity.response.CarPlanTaskResponse;
import com.yimi.yinhepda.views.load_module.LoadUtil;

import java.util.List;

/**
 * 出发封车适配器
 *
 * @author 000432
 * @date 2018/6/6 0006
 */

public class SetOutSealCarNewAdapter extends CommonRecycleAdapter<CarPlanTaskEntity> {

    private Context mContext;
    private CommonViewHolder.onItemCommonClickListener mCommonClickListener;

    public SetOutSealCarNewAdapter(Context context, List<CarPlanTaskEntity> dataList, CommonViewHolder.onItemCommonClickListener commonClickListener) {
        super(context, dataList, R.layout.adapter_set_out_seal_car_new);
        this.mContext = context;
        this.mCommonClickListener = commonClickListener;
    }

    @Override
    public void bindData(CommonViewHolder holder, CarPlanTaskEntity data, int position) {
        holder.setText(R.id.tv_taskNo, data.getTaskNo());
        holder.setText(R.id.tv_carNo, data.getVehNo());
        holder.setText(R.id.tv_route_line, data.getVehLineName());
        holder.setText(R.id.tv_planeTime, data.getPlanStartTime());
        holder.setText(R.id.tv_shift, String.format("%s班次", LoadUtil.getShift(data.getShift())));

        holder.setCommonClickListener(mCommonClickListener);

        holder.getView(R.id.ll_setOut_sealCar_item).setSelected(data.isCheck());
        holder.getView(R.id.tv_carNo).setSelected(data.isCheck());
    }
}
